package com.kdl.webconfig.controller;


import com.kdl.webconfig.vo.BaseRespVO;
import com.kdl.webconfig.vo.config.ButtonConfigVO;
import com.kdl.webconfig.business.ButtonConfigBusiness;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 按钮配置表 前端控制器
 * </p>
 *
 * @author wcj
 * @since 2022-09-05
 */
@RestController
@RequestMapping("/webconfig/buttonConfig")
public class ButtonConfigController {

    @Autowired
    ButtonConfigBusiness buttonConfigBusiness;

    @PostMapping("/saveOrUpdate")
    public BaseRespVO<Boolean> saveOrUpdate(@RequestBody @Valid ButtonConfigVO buttonConfigVO){
        Boolean aBoolean = buttonConfigBusiness.saveOrUpdate(buttonConfigVO);
        return BaseRespVO.success(aBoolean);
    }

    @PostMapping("/delete/{id}")
    public BaseRespVO<Boolean> delete(@PathVariable Integer id){
        Boolean b  = buttonConfigBusiness.deleteById(id);
        return BaseRespVO.success(b);
    }
}

